package com.yu.flow.demo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class WorkflowDefinition {


    private String name;
    private List<TaskConfig> tasks = new ArrayList<>();
    private Map<String, TaskConfig> taskMap = new HashMap<>();

    public WorkflowDefinition(String name) {
        this.name = name;
    }

    public void addTask(TaskConfig taskConfig) {
        tasks.add(taskConfig);
        taskMap.put(taskConfig.getName(), taskConfig);
    }

    public List<TaskConfig> getTasks() {
        return tasks;
    }

    public TaskConfig getTask(String taskName) {
        return taskMap.get(taskName);
    }

    public String getName() {
        return name;
    }
}
